package com.ljx.demo.controller;

import com.ljx.demo.domain.vo.req.LoginForm;
import com.ljx.demo.domain.vo.resp.ApiResult;
import com.ljx.demo.service.AuthService;
import com.ljx.demo.utils.JwtUtil;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.xml.transform.Result;


/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-06-16  23:18
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    @PostMapping("/login")
    public ApiResult<String> login(@Valid @RequestBody LoginForm loginForm){
        String token = authService.login(loginForm);

        return ApiResult.success(token, "success");
    }

    @GetMapping("/test")
    public String test(){

        return "123";
    }

    @GetMapping("/t2")
    public String t2(){

        return "t2";
    }

    @GetMapping("/t1")
    public String t1(){

        return "t1";
    }

    @GetMapping("/t3")
    public String t3(){

        return "t3";
    }
}
